package com.example.smartclassroom.mapper;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.smartclassroom.entity.Admin;
import com.example.smartclassroom.entity.form.LoginForm;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

@Mapper
@Repository
public interface AdminMapper extends BaseMapper<Admin> {

    //登录
    @Select("select * from admin where username=#{username} and password=#{password}")
    Admin login(LoginForm loginForm);

    //注册
    @Insert("insert into admin(username,password) values(#{username},#{password})")
    int insert(LoginForm loginForm);

    //编辑用户信息
    @Update("update admin set admin Name=#{admin_name},phone=#{phone},avatar=#{avatar} where id=#{id}")
    int update(Admin admin);
}
